﻿using System;
using System.Collections.Generic;
using System.Text;

namespace UlsStudio.AppCore
{
    /// <summary>
    /// Data for a new GUI state to put the application in, labels, modes, etc
    /// </summary>
    public class DisplayStateUpdateInfo
    {
        #region Constructors

        private DisplayStateUpdateInfo()
        {
            this.State = ApplicationState.Waiting;
            this.MonitoringMode = MonitoringMode.NotSpecified;
            this.BottomLeftLabel = null;
            this.BottomRightLabel = null;
        }

        /// <summary>
        /// Set just app-state - use default msgs
        /// </summary>
        public DisplayStateUpdateInfo(ApplicationState appState)
            : this()
        {
            this.State = appState;
        }

        /// <summary>
        /// Set state with user-defined loading message (bottom left). 
        /// </summary>
        public DisplayStateUpdateInfo(ApplicationState appState, string loadingStatus)
            : this(appState)
        {
            this.BottomLeftLabel = loadingStatus;
        }

        /// <summary>
        /// Set state with user-defined loading message (bottom left). Used for file-set loading
        /// </summary>
        public DisplayStateUpdateInfo(ApplicationState appState, string loadingStatus, int percentageComplete)
            : this(appState, loadingStatus)
        {
            this.PercentageComplete = percentageComplete;
        }

        /// <summary>
        /// Set state with user-defined loading message (bottom left) and also display message (bottom right)
        /// </summary>
        /// <param name="appState"></param>
        /// <param name="loadingMsg"></param>
        /// <param name="displayMsg"></param>
        public DisplayStateUpdateInfo(ApplicationState appState, string loadingMsg, string displayMsg)
            : this(appState, loadingMsg)
        {
            this.BottomRightLabel = displayMsg;
        }

        /// <summary>
        /// Set state with user-defined loading message (bottom left), a display message (bottom right), and a percentage complete
        /// </summary>
        /// <param name="appState"></param>
        /// <param name="loadingMsg"></param>
        /// <param name="displayMsg"></param>
        public DisplayStateUpdateInfo(ApplicationState appState, string loadingMsg, string displayMsg, int percentageComplete)
            : this(appState, loadingMsg, percentageComplete)
        {
            this.BottomRightLabel = displayMsg;
        }

        /// <summary>
        /// Update real-time-loading status. ApplicationState.Waiting is assumed.
        /// </summary>
        public DisplayStateUpdateInfo(MonitoringMode realTimeStatus, int dirWatchCount)
            : this(ApplicationState.Waiting, "Idle", string.Empty)
        {
            this.MonitoringMode = realTimeStatus;
            this.DirectoryWatchCount = dirWatchCount;
        }

        #endregion

        #region Properties

        /// <summary>
        /// Bottom-left status label
        /// </summary>
        public string BottomLeftLabel { get; set; }

        /// <summary>
        /// Bottom-right status label
        /// </summary>
        public string BottomRightLabel { get; set; }

        /// <summary>
        /// Real-time monitoring mode (enabled/starting/started)
        /// </summary>
        public MonitoringMode MonitoringMode { get; set; }

        /// <summary>
        /// Mode to put the app in (waiting/loading/etc)
        /// </summary>
        public ApplicationState State { get; set; }

        /// <summary>
        /// Number of directories being watched by the real-time scanner
        /// </summary>
        public int DirectoryWatchCount { get; set; }

        /// <summary>
        /// Percent load complete
        /// </summary>
        public int? PercentageComplete { get; set; }

        #endregion
    }
}
